extends Node2D

enum direction{
	UP,
	DOWN,
	LEFT,
	RIGHT
}

func getDirection(oldPoint, newPoint):
	if newPoint.x == oldPoint.x+1:
		return direction.RIGHT
	if newPoint.x == oldPoint.x-1:
		return direction.LEFT
	if newPoint.y == oldPoint.y+1:
		return direction.DOWN
	if newPoint.y == oldPoint.y-1:
		return direction.UP

func directionToVector(di):
	if di == direction.UP:
		return Vector2(0,-1)
	if di == direction.DOWN:
		return Vector2(0,1)
	if di == direction.LEFT:
		return Vector2(-1,0)
	if di == direction.RIGHT:
		return Vector2(1,0)

func getIndexByPosition(position:Vector2) ->Vector2:
	return Vector2(int(position.x/32), int(position.y/32))

func getMousePosition()->Point:
	var p = get_global_mouse_position()
	var point = Point.new();
	point.init(p.x/32, p.y/32)
	return point


